/*
Simple Forum Auto Poster.
Copyright (C) 2011 Gianni Van Hoecke.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
package domain.ui;

import domain.enums.View;
import domain.forumdata.Post;
import java.util.List;

/**
 *
 * @author Gianni Van Hoecke <gianni.vh@gmail.com>
 *
 * Interface that must be used by the "main" UI.
 */
public interface UI
{
    /**
     * @return A list of the selected forums.
     */
    public String[] getSelectedForums();

    /**
     * Notifies the UI to load the look and feel.
     */
    public void loadLookAndFeel();
    
    /**
     * Notifies the UI to load the available categories.
     */
    public void loadCategories();

    /**
     * Notifies the UI to load the available forums.
     */
    public void loadForums();

    /**
     * Notifies the UI to load the available history.
     * @param historyList the list to load.
     */
    public void loadHistory(List<Post> historyList);

    /**
     * @return The log.
     */
    public String getLog();

    /**
     * Notifies the UI to show a message to the user.
     * @param message The message to show.
     * @param title The title for the message.
     */
    public void fireInformationMessage(String message, String title);

    /**
     * @return The selected category.
     */
    public String getSelectedCategory();

    /**
     * Notifies the UI to initiate posting.
     */
    public void postNewTopic();

    /**
     * Notifies the UI to preview the new post.
     */
    public void previewNewTopic();

    /**
     * Updates the progress.
     * @param progress The percentage.
     * @param status The status to show.
     */
    public void updateProcess(int progress, String status);

    /**
     * Notifies the UI to check the enabled state of buttons.
     * @param enabled True when buttons should be enabled, false otherwise.
     */
    public void setButtonsEnabled(boolean enabled);

    /**
     * Notifies the UI that posting has been completed.
     */
    public void fireDone();

    /**
     * Notifies the UI to ask a YES/NO question to the user.
     * @param question The question.
     * @param title The title of the question.
     * @return True if the user answered YES, false otherwise.
     */
    public boolean fireYesNoQuestion(String question, String title);

    /**
     * Notifies the UI to clear the current post.
     */
    public void clearPost();

    /**
     * Notifies the UI to load a history item.
     * @param post The post to load.
     */
    public void loadHistoryItem(Post post);

    /**
     * Notifies the UI to load a history entry into the "new topic" area.
     * @param post The post to load.
     */
    public void loadPost(Post post);

    /**
     * Notifies the UI to change its view.
     * @param view The view to show.
     */
    public void changeViewTo(View view);

    /**
     * Notifies the UI to load its menu bar.
     */
    public void loadMenuBar();

    /**
     * Notifies the UI to set the "new topic" area.
     * @param body The message.
     */
    public void setPostBodyTo(String body);

    /**
     * @return The message of the new post.
     */
    public String getPost();

    /**
     * Notifies the UI to insert a tag at the caret position.
     * @param tag The tag to insert.
     */
    public void insertTagInPostBody(String tag);

    /**
     * Notifies the UI to check wheather the forum UI must be shown or not.
     */
    public void updateForumUI();

    /**
     * Asks the user for a CAPTCHA code.
     * @param src The image URL of the CAPTCHA code.
     * @return the user input.
     */
    public String askCaptchaCode(String src);

    /**
     * Sets wheather the status should be indeterminate or not.
     * @param value True for indeterminate, false otherwise.
     * @param status The text to display.
     */
    public void setStatusIndeterminate(boolean value, String status);

    /**
     * @return The selected text in the post body.
     */
    public String getSelectedTextInPost();

    /**
     * Sets the working LAF.
     * @param className The class name of the LAF.
     */
    public void setLookAndFeel(String className);

    /**
     * Gets the current post and all its settings.
     * @return A new Post object.
     */
    public Post getCurrentPost();

    /**
     * Updates the password UI after a change.
     */
    public void updatePasswordUI();

    /**
     * Asks a password input from the user.
     * @param text The text to show to the user.
     * @param title The title of the box.
     * @return The char array.
     */
    public char[] askPassword(String text, String title);

    /**
     * Notifies the UI to (re)load the queue.
     */
    public void loadQueue();

    /**
     * @return The selected item in the queue list.
     */
    public String getSelectedQueueItem();

    /**
     * Notifies the UI to (re)load the threads UI.
     */
    public void loadThreads();

    /**
     * Notifies the UI to (re)load the cool down period UI.
     */
    public void loadCoolDownPeriod();

    /**
     * Notifies the UI to (re)load the retry UI.
     */
    public void loadRetry();

    /**
     * Adds a certain value to the overall progress.
     * @param i The value to add.
     */
    public void addProgress(int i);

    /**
     * Notifies the UI to show all posting errors.
     */
    public void showPostingErrors();

    /**
     * Notifies the UI to show the error.
     * @param error The error string.
     */
    public void showErrorAsHTML(String error);
}